import org.apache.http.HttpHost;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;

import junit.framework.TestCase;

public class HttpClientTest extends TestCase {
    public void testA() throws Exception {
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpParams params = httpClient.getParams();

        HttpConnectionParams.setConnectionTimeout(params, 1 * 1000);
        HttpConnectionParams.setSoTimeout(params, 10 * 1000);

        HttpHost proxyHost = new HttpHost("127.0.0.1", 80);
        httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost);

        HttpGet get = new HttpGet("http://www.baidu.com");
        httpClient.execute(get);
    }
}
